package com.qxzn.module.home.activity;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.qxzn.app.bean.BindRobotBean;
import com.qxzn.app.page.BaseActivity;
import com.qxzn.app.page.widget.statusbar.StatusBar;
import com.qxzn.app.util.ActivityStack;
import com.qxzn.app.util.AppUtil;
import com.qxzn.module.home.R;
import com.qxzn.module.home.R2;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 等待管理员授权
 */
public class WaitForAdminAuthActivity extends BaseActivity {
    @BindView(R2.id.iv_head)
    ImageView ivHead;
    @BindView(R2.id.tv_xiaopai_name)
    TextView tvXiaoPaiName;
    @BindView(R2.id.tv_device_id)
    TextView tvDeviceId;
    @BindView(R2.id.tv_admin)
    TextView tvAdmin;
    @BindView(R2.id.tv_phone)
    TextView tvPhone;
    @BindView(R2.id.tv_status)
    TextView tvStatus;
    private BindRobotBean data;

    @Override
    protected int initLayout() {
        return R.layout.activity_wait_for_admin_auth;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void iniTitleBar() {
        title_bar.setVisibility(View.GONE);
    }

    @Override
    protected void setStatusBarColor() {
        StatusBar.setStatusBarLightMode(this, getResources().getColor(R.color.blue_3FC7FF));
    }

    @Override
    protected void initData(Bundle savedInstanceState) {
        data = (BindRobotBean) getIntent().getSerializableExtra("data");
        if (data == null) {
            AppUtil.showToast(this, "数据有误");
            finish();
            return;
        }
//        tvXiaoPaiName.setText(data.getString(""));
        tvDeviceId.setText("ID：" + data.getDevice_id());
//        tvAdmin.setText(data.getString("nickname"));
        tvPhone.setText(data.getFirst_name());
//        Glide.with(this).load(HttpRequest.BASE_URL + data.getString("headportrait")).apply(RequestOptions.circleCropTransform().placeholder(R.mipmap.icon_xiaopai).error(R.mipmap.icon_xiaopai)).into(ivHead);
    }

    @OnClick({R2.id.iv_back1})
    public void onViewClicked(View view) {
        int i = view.getId();
        if (i == R.id.iv_back1) {
            ActivityStack.finishAllWithoutActivity("com.qxzn.app.desktoprobot.MainActivity");
        }
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
            ActivityStack.finishAllWithoutActivity("com.qxzn.app.desktoprobot.MainActivity");
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

}
